package com.hbnu.service.impl;

import com.hbnu.bean.Door;
import com.hbnu.bean.Order;
import com.hbnu.dao.OrderMapper;
import com.hbnu.service.DoorService;
import com.hbnu.service.OrderService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

@Service
public class OrderServiceImpl implements OrderService {
    @Resource
    private OrderMapper orderMapper;
    public List<Order> findAllOrders() {
        return orderMapper.findAllOrders();
    }

    public void NewOrderAdd(Order order) {
        order.setOrderTime(new Date());
        order.setPayTime(order.getOrderTime());
        orderMapper.NewOrderAdd(order);
    }

    public void DeleteOrderById(Integer id) {
        orderMapper.DeleteOrderById(id);
    }

    public Order findOrderById(Integer id) {
        return orderMapper.findOrderById(id);
    }

    public void UpdateOrder(Order order) {
        orderMapper.UpdateOrder(order);
    }
}
